<div class="container">
    <div class="row" >
        <div class="span12 blockGray">
            <div class="blockInner">
                <h1>Mis Proovedores</h1>
                <a class="btn" href="<?php echo $view->url(array('controller'=>'BackStore','action'=>'createOrder','module'=>'User', 'buyer' => '1'));?>" title="Agrega una orden manualmente">Agregar nueva orden</a>
                <div class="clear">&nbsp;</div>
                <?php
                if(count($view->orders)>0)
                {
                ?>
                <div class="">
                    <table class="table table-striped table-bordered">
                        <thead>
                            <tr>
                                <th>Folio</th>
                                <th>Recurrente</th>
                                <th>Vendedor</th>
                                <th>Pagado</th>
                                <th>Entregado</th>
                                <th>Fecha de pedido</th>
                                <th>Detalles</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                                foreach ($view->orders as $order)
                                {
                                    //si son ordenes simples
                                   $img = '<img src="'.$view->getBaseUrl().'/images/ok-icon.png"/>';
                                    if($order->getRecurrent() == DefaultDb_Entities_M3CommerceOrder::RECURRENT_NOTACTIVE)
                                    { 
                                ?>
                                    <tr>
                                        <td><?php echo $order->getId(); ?></td>
                                        <td><?php echo $img = ($order->getOrderParent() != null)? $img : "";?></td>
                                        <td><?php echo $order->getSeller()->getCommercialName(); ?></td>
                                        <td><?php echo $order->getPaymentStatusString(); ?></td>
                                        <td><?php echo $order->getShippingStatusString(); ?></td>
                                        <td><?php ?></td>
                                        <td><?php echo '<a href="'.$view->url(array('controller' => 'BackStore', 'action' => 'viewOrderShopping', 'id' => $order->getId())).'">Orden '.$order->getId().'</a>';?></td>
                                    </tr>
                                <?php
                                    }
                                }
                            ?>

                        </tbody>
                    </table>
                    <?php if($view->recurrentsFlag):?>
                      <table class="table table-striped table-bordered">
                        <thead>
                            <tr>
                                <th>Folio</th>
                                <th>Recurrente</th>
                                <th>Vendedor</th>
                                <th>Pagado</th>
                                <th>Entregado</th>
                                <th>Fecha de pedido</th>
                                <th>Detalles</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                                foreach ($view->orders as $order)
                                {//si son ordenes recurrentes
                                    if($order->getRecurrent() == DefaultDb_Entities_M3CommerceOrder::RECURRENT_ACTIVE)
                                    { 
                                ?>
                                    <tr>
                                        <td><?php echo $order->getId(); ?></td>
                                        <td><?php echo $img = ($order->getOrderParent() != null)? $img : "";?></td>
                                        <td><?php echo $order->getSeller()->getFullName(); ?></td>
                                        <td><?php echo $order->getPaymentStatusString(); ?></td>
                                        <td><?php echo $order->getShippingStatusString(); ?></td>
                                        <td><?php ?></td>
                                        <td><?php echo '<a href="'.$view->url(array('controller' => 'BackStore', 'action' => 'viewOrderShopping', 'id' => $order->getId())).'">Orden '.$order->getId().'</a>';?></td>
                                    </tr>
                                <?php
                                    }
                                }
                            ?>

                        </tbody>
                    </table>
                    <?php endif; ?>
                </div>
                <?php
                }
                else
                {
                    echo '<div class="alert alert-error">Actualmente no tiene compras.</div>';
                }
                ?>
            </div>
        </div>
    </div>
</div>